﻿<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>测试结果</title>
	<script src="../js/jquery-3.2.1.min.js"></script>
		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="../css/bootstrap.min.css" >	
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="../js/bootstrap.min.js" ></script>
	<link rel="stylesheet" type="text/css" href="../css/index.css">
</head>
<body>
	<div>
	<nav class="navbar navbar-default navbar-fixed-top top" >
		<a href="../"><img class="top_left" src="../images/log.png"></a>
		<div class="pull-right" style="margin-top: 15px;margin-right: 20px;">
			<a href="http://www.xinli001.com/ceshi">关于心理测试</a>
			<a href="bbs.php">去留言</a>
	
		</div>
		</nav>
	</div>	
	<br>
	<br>
			<!-- 连接数据库 -->
			<?php
				mysql_connect("localhost","root","root");
				mysql_query("set names utf8 "); 
				// 执行sql语句
				$query="select * from question";
				$query2="select * from result";
				$result = mysql_db_query("psychology","$query");
				$res2 = mysql_db_query("psychology","$query2");
				
			?>
			<!-- 输出问题 -->
			<div>
				<?php

					$i=0;//循环用户所选择数组的游标
					while ($data= mysql_fetch_object($result) and $data2= mysql_fetch_object($res2) ) {
						$arr = array($result1,$result2,$result3,$result4,$result5,$result6);//该数组保存用户的答案
						?>
						<div id="question" style="margin-left: 50px; >
							 
							<h1> <a href="" data-toggle="tooltip" data-placement="right" title='<?php echo
							$arr[$i]; $i++;?>'><?php echo $data->questionNum?></a>: <?php echo $data->questionPart;?>
							</h1>
							<ul style="margin-left: 50px;">
								<!-- data-container="body"向指定元素追加弹出框 -->
								<li><button type="button" class="btn btn-default" title="该选项的解释如下"	data-container="body" data-toggle="popover" data-placement="right" data-content="<?php echo $data2->resultA ;?>"><?php echo $data->answerA ; ?></button></li>
								<li><button type="button" class="btn btn-default" title="该选项的解释如下"	data-container="body" data-toggle="popover" data-placement="right" data-content="<?php echo $data2->resultB ;?>"><?php echo $data->answerB ; ?></button></li>
								<li><button type="button" class="btn btn-default" title="该选项的解释如下"	data-container="body" data-toggle="popover" data-placement="right" data-content="<?php echo $data2->resultC ;?>"><?php echo $data->answerC ; ?></button></li>
								<li><button type="button" class="btn btn-default" title="该选项的解释如下"	data-container="body" data-toggle="popover" data-placement="right" data-content="<?php echo $data2->resultD ;?>"><?php echo $data->answerD ; ?></button></li>
							</ul>
							
						</div>
						<?php
					}
				?>
			</div>
			<script>
				// 通过js激活弹出框
			$(function () { 
			$("[data-toggle='popover']").popover();
			});
			</script>
		
		<!-- 版权 -->
		<div  style="text-align:center">
			<hr>
			<font>©2018 chenshuwei AND yangliu.<br/>All Rights Reserved.<br/>
			电话：0991-123456</font>
		</div>

</body>
</html>